package com.cscj.android.repository.db.entity

import androidx.room.Entity
import androidx.room.PrimaryKey
import java.util.Date

/**
 * 收藏夹
 */
@Entity("favorite")
data class FavoritesEntity(
    @PrimaryKey(autoGenerate = true) val id: Int = 0,
    val pid: Int = 0, //根收藏夹pid为0
    val type: Int,
    val title: String,
    val addDate: Date,
    val icon: String? = null, //base64 image
    val visible: Boolean = true, //
    val url: String? = null, //收藏的URL，只有type=TYPE_ITEM时才有
) {
    companion object {
        const val TYPE_ROOT = 0
        const val TYPE_FOLDER = 1
        const val TYPE_ITEM = 2
        const val RootId = -1
    }

    fun isRootItem(): Boolean{
        return id == RootId || type == TYPE_ROOT
    }
}
